package com.hksj.base.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hksj.base.query.RoomPropertyQuery;
import com.hksj.base.service.RoomPropertyService;
import com.hksj.base.vo.CompositeRoomPropertyVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@Api(tags = "综合驾驶舱导出")
@RestController
@RequestMapping("/api/comm/room")
public class RoomPropertyController {
    @Autowired
    private RoomPropertyService roomPropertyService;

    @ApiOperation(value = "查询每个房间的温度、湿度、压差",response = CompositeRoomPropertyVO.class)
    @PostMapping("/pageRoom")
    public Rest<Page<CompositeRoomPropertyVO>> pageRoom(@RequestBody RoomPropertyQuery query){
        Page<CompositeRoomPropertyVO> page = roomPropertyService.pageRoom(query);
        return Rest.ok(page);
    }

    @ApiOperation("每个房间的温度、湿度、压差-导出")
    @PostMapping("/exportRoomProperty")
    public void exportRoomProperty(@RequestBody RoomPropertyQuery query,HttpServletResponse response){
        roomPropertyService.exportRoomProperty(query,response);
    }
}
